package com.infonam.data.source.model;

import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="actor" ,catalog="sakila")
public class Actor {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="actor_id", unique=true,nullable=false)
	private int actor_id;
	@Column(name="first_name", nullable=false, length=45)
	private String first_name;
	@Column(name="last_name", nullable=false, length=45)
	private String last_name;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="last_update", nullable=false,columnDefinition="TIMESTAMP default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP")
	private Date last_update;
	
	@OneToMany(fetch=FetchType.LAZY, mappedBy="pk.actor")
	@Cascade(CascadeType.ALL)
	private List<FilmCategory> listFilmCategories = new LinkedList<FilmCategory>();
	public int getActor_id() {
		return actor_id;
	}
	public void setActor_id(int actor_id) {
		this.actor_id = actor_id;
	}
	public String getFirst_name() {
		return first_name;
	}
	public void setFirst_name(String first_name) {
		this.first_name = first_name;
	}
	public String getLast_name() {
		return last_name;
	}
	public void setLast_name(String last_name) {
		this.last_name = last_name;
	}
	public Date getLast_update() {
		return last_update;
	}
	public void setLast_update(Date last_update) {
		this.last_update = last_update;
	}
	public List<FilmCategory> getListFilmCategories() {
		return listFilmCategories;
	}
	public void setListFilmCategories(List<FilmCategory> listFilmCategories) {
		this.listFilmCategories = listFilmCategories;
	}
	
}
